package cn.yx.common.core.enums.http;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>自定义Http请求头枚举</p>
 *
 * @author Wgssmart
 */
public enum HttpHeaderCustomEnum {

    /**
     * 事务ID
     */
    TRANSACTION_ID("Transaction-Id", "事务ID");

    private final String name;
    private final String desc;

    private static final Map<String, HttpHeaderCustomEnum> LOOKUP;

    static {
        LOOKUP = new HashMap<>();
        for (HttpHeaderCustomEnum httpHeaderCustomEnum : EnumSet.allOf(HttpHeaderCustomEnum.class)) {
            LOOKUP.put(httpHeaderCustomEnum.getName(), httpHeaderCustomEnum);
        }
    }

    HttpHeaderCustomEnum(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    public static HttpHeaderCustomEnum findByName(String name) {
        return LOOKUP.get(name);
    }

}
